package com.leetcode.partition6;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/2/27 19:34
 */
public class LC553最优除法 {

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(reader.readLine());
        String[] ss = reader.readLine().split(" ");
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = Integer.parseInt(ss[i]);
        writer.write(optimalDivision(nums));
        writer.flush();
    }

    public static String optimalDivision(int[] nums) {
        StringBuilder sb = new StringBuilder();
        int n = nums.length;
        for (int i = 0; i < n; i++) {
            sb.append(nums[i]);
            if (i + 1 < n) sb.append('/');
        }
        if (n > 2) {
            sb.insert(sb.indexOf("/") + 1, '(');
            sb.append(')');
        }
        return sb.toString();
    }
}
